package test.study.rpc.dubbo.client;

import cn.hutool.core.thread.ThreadUtil;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
import org.junit.Test;
import study.rpc.dubbo.api.GreetingService;

public class Gaa {

    @Test
    public  void test() {
        ReferenceConfig<GreetingService> reference = new ReferenceConfig<>();
        reference.setInterface(GreetingService.class);
        reference.setVersion("1.0");

        DubboBootstrap.getInstance()
                .application("first-dubbo-consumer")
                .registry(new RegistryConfig("nacos://101.42.254.155:8848"))
                .reference(reference);

        GreetingService service = reference.get();
        String message = service.sayHi("dubbo");
        System.out.println("Receive result ======> " + message);

        ThreadUtil.waitForDie();
    }
}
